1. Field of Art
The disclosure relates generally to transcoding a video sequence from one format to another, and more specifically to transcoding a video sequence in a H.264 format to a MPEG-2 format or transcoding a video sequence in the MPEG-2 format to the H.264 format.
2. Description of Related Art
The H.264 standard allows two fields of an interlaced frame to be coded separately (i.e., field-based coding). Specifically, in the H.264 standard, the frame/field coding of a frame may be adaptively varied using a scheme called Macroblock-Adaptive Frame/Field (MBAFF) coding. If a frame consists of mixed regions where some regions are moving and others are not, it is generally more efficient to code the non-moving regions in the frame-based coding, and the moving regions in the field-based coding.
FIG. 1 is a diagram illustrating a pair of field macroblocks 10 coded in a non-MBAFF coding sequence and a pair of field macroblocks 12 coded in an MBAFF coding sequence. In a pair of macroblocks 10 that are coded in the non-MBAFF coding sequence, both of the top macroblock 10A and the corresponding bottom macroblock 10B include odd and even lines of the interlaced frame (i.e., lines from both interlaced fields). In contrast, in a pair of field macroblocks 12 that are coded in the MBAFF coding sequence, the top macroblock 12A includes only odd lines of the frame (lines from one interlaced field) and the bottom macroblock 12B includes only even lines of the frame (lines from the other interlaced field). MBAFF frame macroblock pairs have the same line order as non-MBAFF macroblocks.
Some video encoding formats such as the MPEG-2 do not use the MBAFF coding sequence whereas the H.264 format can use the MBAFF coding sequence. Therefore, in order to efficiently transcode a frame picture video sequence in the H.264 MBAFF format to the MPEG-2 format or vice versa, the macroblocks must be reformatted and reorganized. Referring to FIGS. 2A and 2B, the sequences of encoding or decoding the macroblocks in the MBAFF coding sequence and the non-MBAFF coding sequence are illustrated.
In FIG. 2A, a frame 20A processed in the non-MBAFF coding sequence is illustrated. The frame 20A in the non-MBAFF case is generally processed on a per macroblock basis. In the frame 20A, the macroblocks are processed row by row. That is, one row of macroblocks is processed and then the next row of macroblocks is processed. The processing of the frame 20A is very resource intensive, requiring extensive amount of time and computations.
In FIG. 2B, a frame 20B processed in the MBAFF coding sequence is illustrated. In the MBAFF coding sequence, the macroblocks are processed in a zigzagged manner. For example, a top macroblock (for example, macroblock 0) is processed, followed by a bottom macroblock (for example, macroblock 1), and then another top macroblock (for example, macroblock 2), then a corresponding bottom macroblock (for example, macroblock 3), and so forth. Once all macroblocks in the two rows are processed, the next two rows of macroblocks are processed in the same manner.
FIG. 3 illustrates a conventional transcoding system for transcoding a frame encoded in the MBAFF coding sequence (for example, H.264 format) to a frame that is encoded in the non-MBAFF coding sequence (for example, MPEG-2 format) or vice versa. The transcoding system includes a transcoder chip 300 and external memory 330 coupled to the transcoder chip 300. The transcoder chip 300 includes a video decoding module 310 and a video encoding module 320. The video decoding module 310 reads a frame 322 of the video sequence from the external memory 330, decodes macroblocks of the frame, and then stores the decoded frame 324 in the external memory 330. Then the video encoding module 320 reads the decoded frame 324 from the memory 330, encodes the frame 324 into a transcoded frame 326, and stores the transcoded frame 326 in the external memory 330.
Note that the macroblocks decoded from the video decoding module 310 cannot be directly fed to the video encoding module 320 because the sequence for encoding the macroblocks in the video encoding module 320 is different from the sequence in which the macroblocks are decoded by the video decoding module 310. Accordingly, the video decoding module 310 and the video encoding module 320 must store and retrieve decoded macroblocks 324 via the external memory 330 to encode the decoded macroblocks 324 in a proper sequence. This results in increased amount of data exchange between the transcoding system 300 and the external memory 330 as well as increased time for transcoding the frame due to heavy data traffic between the external memory 330 and the transcoder chip 300.
The deblocking process also adds the data transfer 318 between the transcoder chip 300 and the external memory 330. In order to completely deblock a target macroblock (encoded either in the MBAFF coding sequence or in the non-MBAFF coding sequence), a deblocking filter 312 needs the macroblocks (up, down, left and right macroblocks) surrounding the target macroblock and in some cases, including macroblocks that are two macroblocks above and below. Storing 332 decoded macroblocks in the external memory 330 and then retrieving 328 the decoded macroblocks by the deblocking filter 312 for deblocking add additional data traffic between the transcoding system 300 and the memory 330, further slowing down the overall transcoding process. Moreover, there are increased costs associated with providing additional memory space in the external memory 330 for storing the decoded macroblocks even if on a temporary basis.
Therefore, the present art lacks a transcoder system that reduces data traffic between a transcoder chip and external memory when transcoding a video sequence between formats that use the MBAFF coding sequence and formats that does not use the MBAFF coding sequence. The present art also lacks a transcoder system that does not require the data transfer between the transcoder chip and external memory during deblocking process.